
GOPATH:=$(shell go env GOPATH)
.PHONY: init
init:
	go get -u github.com/golang/protobuf/proto
	go get -u github.com/golang/protobuf/protoc-gen-go
	go get github.com/micro/micro/v3/cmd/protoc-gen-micro
	go get github.com/micro/micro/v3/cmd/protoc-gen-openapi
	go get -u github.com/gogo/protobuf/protoc-gen-gofast

.PHONY: proto
proto:
	protoc --proto_path=. --micro_out=. --gofast_out=:. proto/ProgramUpload.proto

.PHONY: run
run:
	go run main.go
	
.PHONY: build-linux
build-linux:
	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ProgramUpload *.go

.PHONY: test
test:
	go test -v ./... -cover

.PHONY: docker-build
docker-build:
	make build-linux
	docker build . -t srv-program-upload:latest

.PHONY: docker-stop
docker-stop:
	docker stop srv-program-upload
